{include file="common/head"/}
<style type="text/css">
.layui-select-title .layui-input{ position: relative; text-align: center; z-index: 9; background: none}
.layui-select-title .layui-edge{z-index: 8}
</style>
<div class="main"> 
	<div class="channel_title"><img src="/static/pay/cashierlogo.png" alt="{$title}"></div>
	<div class="channel_box"><div class="item"><span class="name">商户：</span><span class="price">0.00/件</span></div></div>  
	<div class="order_form">
		<form class="layui-form layui-form-pane" method="post" autocomplete="off" action="{:url('pay/paydemo/index')}" id="payform" target="_blank">  
			<div class="layui-form-item">
				<label class="layui-form-label paytype">
					<select name="paytype" id="paytype"  lay-filter="paytype">
	                    <option value="">支付方式</option>
	            	</select>
	            </label>
				<div class="layui-input-block">
					<input type="text" name="money" id="money"  autocomplete="off" placeholder="请输入支付金额" class="layui-input">
				</div>
			</div> 
	        <div class="layui-form-item">
	            <label class="layui-form-label">备注说明</label>
	            <div class="layui-input-block">
	                <input type="text" name="note" autocomplete="off" placeholder="请填写您付款时所使用的账号" class="layui-input">
	            </div>
	        </div>
			<div class="layui-form-item">  
                <button type="submit" class="layui-btn layui-btn-fluid" lay-filter="paysub"  lay-submit>确认提交</button> 
			</div>
		</form>
	</div>
</div>
<script>  
layui.use(['form', 'layer'], function () {
	var layer = layui.layer,form = layui.form,$ = layui.jquery;
	getchannel=$.get("{$channelurl}",function(rel) { 
	    var showbox=$('.channel_box'); 
	    if(rel.code=='0'){  
	    	var info=rel.data;    
	    	showbox.html('<div class="item"><span class="name">商户：'+info[0]['title']+'('+info[0]['cionname']+')</span><span class="price">'+info[0]['price']+'/件</span></div>');
	    	var paytype=rel.payinfo;  
			$('#paytype').empty();
	    	for(var i in paytype){  
	    	 	$('#paytype').append('<option value="'+paytype[i]['bankid']+'">'+paytype[i]['name']+'</option>');
	    	}    
	    	$('#payform').append('<input name="site" class="layui-hide" value="'+info[0]['channelid']+'">');
	    	$('#payform').append('<input name="gotopay" class="layui-hide" value="'+rel.payurl+'">'); 
		    form.render('select');  //重新渲染下拉 
	    }else{
	    	showbox.html('<div class="item null">'+rel.msg+'</div>');
	    }
	}); 
	form.on('submit(paysub)', function (data){
		if(!data.field.money){layer.msg('请输入支付金额'); return false;}
		if(!data.field.paytype){layer.msg('请选择一个付款方式'); return false;} 
		// if(!data.field.note){layer.msg('请填写您付款时所用的账户名称'); return false;} 
        $("form").submit();        
    }); 
}); 
</script> 
</body>
</html>